Repository navigation
fix(ui): judge requiredWhen as a transition gate on the console form page, the kanban drop prompt and the Edit wizard - #30301
Merged
Conversation
…age and the kanban drop prompt An Edit through /forms/:name?recordId= and a kanban drop now read the stored-row verdict resolveFieldRuleState already carries (requiredWhenAtRest): a record already inside the gate without the value saves an unrelated edit, as the engine allows. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziwFKBXQchtNMQYZSX
…ge and the kanban drop prompt Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziwFKBXQchtNMQYZSX
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziwFKBXQchtNMQYZSX
Contributor
Author
|
domain:ui#4 · os-support-ai · session_01WGufzinedUGSXteN45poyo 维护者速读
席位意见:ACCEPT(本 PR 覆盖的两处)。向导一处未动,卡片 #30220 在合并后仍保持打开。 席位核对ACCEPT → PR #30301 @
|
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziwFKBXQchtNMQYZSX
…ion gate (ruled option A) On an Edit wizard, gateFinalSubmit skips a field the live verdict calls required when requiredWhenRestsOnStoredRecord answers that the stored row already rests inside its gate. The persisted record reaches only that stored-row check; the live resolveFieldRuleState call still binds no previous, so the objectui#8069 option-D refusal and its visibleWhen residual stand unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziwFKBXQchtNMQYZSX
…gate changeset Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziwFKBXQchtNMQYZSX
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziwFKBXQchtNMQYZSX
Contributor
Author
|
domain:ui#4 · os-support-ai · session_01WGufzinedUGSXteN45poyo 维护者速读
席位意见:ACCEPT(第二轮,覆盖整张卡)。 席位核对ACCEPT → PR #30301 @
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Yibo Wang · project thread
Fixes #30220
Clause-②: no
Metadata-protocol: none
维护者速读
requiredWhen(转移闸门):控制台表单页(/forms/:name?recordId=编辑)、看板拖放提示、编辑向导的最终提交检查。记录本来就处在闸门内且缺值时,不再拦住无关编辑、不再弹窗索要该字段;把记录移入闸门、清空已有值的编辑照旧拦截。向导按你在 requiredWhen is still judged against current values in three more form doors: the edit wizard, the console FormPage, and the kanban drop prompt #30220 上裁决的 A 实现:已存记录只交给存量判定,实时判定仍不绑定previous。PATCH本身返回 200。requiredWhenAtRest/requiredWhenRestsOnStoredRecord),没有第二套规则;最坏情况是客户端放行、服务端拒绝,拒绝信息照常显示。回滚即还原本 PR。ui/packages/plugin-form/src/WizardForm.tsx(gateFinalSubmit新增的isEditWizard && !field.required && requiredWhenRestsOnStoredRecord(...)分支)、ui/apps/console/src/components/FormPage.tsx(resolveRowState多了name: field.name)、ui/packages/plugin-kanban/src/requiredWhenPrompt.ts(多了name)。pnpm --dir ui exec vitest run packages/plugin-form/src/wizardSkipValidation.test.tsx apps/console/src/components/FormPage.conditionalRules.test.tsx packages/plugin-kanban/src/requiredWhenPrompt.test.ts,预期全绿,其中三个「…already inside the gate…」用例通过。What changes
The engine's rule (
packages/objectql/src/validation/rule-validator.ts, the "ADR-0113 non-regression: reject iff the MERGED state violates AND the PRE state complied" block,preViolated) refuses an update only when the merged record violatesrequiredWhenand the stored row complied. #30216 mirrored that in@object-ui/coreresolveFieldRuleState: givenprevious(the stored row) andstatics.name, a stored row already inside the gate without the value resolvesrequired: false/requiredWhenAtRest: true. A caller that passes nonamekeeps the plain verdict, and the stored-row check is exported alone asrequiredWhenRestsOnStoredRecord. This PR makes the three remaining doors read it:ui/apps/console/src/components/FormPage.tsx,resolveRowState): it already passed the stored record (loaded.record, theGET /data/:object/:idrow) asprevious; it now passesname: field.name. The asterisk,aria-requiredand the page's own submit check (findSubmitRefusals) all read this one verdict, so all three follow. A create form passes nopreviousand is unchanged.ui/packages/plugin-kanban/src/requiredWhenPrompt.ts,collectRequiredWhenPromptFields): it already passed the pre-drop record asprevious; it now passesname. A drop of a record already inside the gate without the value issues the plain single-keyPATCHwith no dialog; a drop that moves a compliant record into the gate still opens the "Complete required fields" dialog.ui/packages/plugin-form/src/WizardForm.tsx,gateFinalSubmit), as ruled on requiredWhen is still judged against current values in three more form doors: the edit wizard, the console FormPage, and the kanban drop prompt #30220 (option A, ruling record 6656113078): on an Edit wizard, after the live verdict, a field is skipped whenrequiredWhenRestsOnStoredRecord(field.requiredWhen, name, persistedRecord, predicateScope)answers true and the field is not statically required. The liveresolveFieldRuleStatecall still binds noprevious, so objectui#8069's option-D refusal (no new binding pipeline) and its acceptedvisibleWhenresidual are unchanged;persistedRecord(the record as first read, the same one the step forms receive aspreviousValues) reaches only the stored-row check, which can only relax arequiredWhen, reports no fault, and counts an unevaluable predicate as compliant. The gate's note says so next to the option-D note.No new rule and no change in
@object-ui/core. No engine-side door: the engine already implements the gate (thepreViolatedcheck), so there is nodomain:serverhalf.Why
#30216 fixed the record Edit form only. The same record (a contract activated before its signed-copy rule existed) was still refused by the console form page ("Required: Signed Copy"), prompted for the signed copy by a kanban drop into another priority column, and refused by an Edit wizard's final submit, while REST
PATCHanswers 200 for these writes.Tests
FormPage.conditionalRules.test.tsx(the file's existing harness, new top-level describe, realFormPageon/forms/:name?recordId=): a record already activated with no signed copy shows no required marker and saves an unrelated edit (onePATCH, body carries the edit). CONTROL: clearing the value of an activated record that held it is refused (marker shown,toast.error, no write).requiredWhenPrompt.test.ts(new top-level describe): a record already inside the gate dropped into another column of an unrelated grouping collects nothing. CONTROL: a draft dropped intoactivatedstill collectssigned_copy.wizardSkipValidation.test.tsx(the cross-step gate's harness, new top-level describe, realWizardFormin edit mode,allowSkip, the field on the skipped step so only the gate judges it): an activated record with no signed copy saves an unrelated edit (oneupdate). CONTROL: a draft moved toactivatedwithout the copy is refused, noupdate, and the wizard lands on the step holding the field.Acceptance notes
Clause-②: no:resolveRowState,collectRequiredWhenPromptFieldsandWizardFormkeep their signatures and props; only the verdict for a stored row already inside the gate changes.PATCH ... -> 200reading are the evidence.Verification
Head:
4af42bb2(baseorigin/mainmerged at1013ef11). Round 2 (the wizard, ruled option A) added99f59f62(the fix) andfe2c28f0(the changeset) plus two merges oforigin/main; the readings below say which head they were taken on.Round 2: the Edit wizard (tests, ablation, type-check)
Re-run on
4af42bb2:wizardSkipValidation.test.tsx,wizardVisibleWhenFault-8069.test.tsx(the option-D residual pins, unchanged and green),FormPage.conditionalRules.test.tsx,requiredWhenPrompt.test.ts: Test Files 4 passed (4), Tests 54 passed (54).The CONTROL stayed green under the ablation (it pins the gate holding).
WizardFormis imported by relative path from the test, so nodist/is involved.npx eslint src/WizardForm.tsx src/wizardSkipValidation.test.tsx(plugin-form): 0 errors.Browser check on a dev boot (showcase, fresh, built from this branch at origin/main 31260ca + this diff; Vite console serving src)
Seeded by API as admin: writable package
com.qa.rwgate, objectrwgate_contract(status draft/activated, priority low/high,signed_copytext) with three rows inserted BEFORE the rule existed, then the object re-saved withsigned_copy.requiredWhen: record.status == 'activated'; a kanban grouped by priority (default list), a kanban grouped by status (by_status), a simple form view, an app.Engine control on the same boot (REST):
PATCHthe activated row with no signed copy{priority: high}answered 200;PATCHthe draft row{status: activated}answered 400VALIDATION_FAILED("Signed Copy is required").--force, served code checked)Signed Copy*, refused "Required: Signed Copy", no writeSigned Copy,PATCH /data/rwgate_contract/0zgY… -> 200, "Submitted"Signed Copy*)PATCH ... -> 200, card in HighShots:
/mnt/project-files/ui-orders/30220-shots/(before-1..4,after-1..4, one per leg). The boot and the Vite server were stopped after the run (health 000).Round 1: targeted tests, type-check, lint (on 4febaa7)
Re-run on the merged head 4febaa7:
FormPage.conditionalRules.test.tsx,requiredWhenPrompt.test.ts,ObjectKanban.requiredWhenPrompt.test.tsx: Test Files 3 passed (3), Tests 47 passed (47).npx eslinton the four touched files from their package dirs: 0 errors (26 pre-existing warnings in FormPage.tsx, none on touched lines).Round 1: ablation per site, form page and kanban (fix removed, pin goes red, restored to HEAD)
Both CONTROL cases stayed green under the ablation, as predicted: they pin the gate holding, which the plain verdict also gives. Both subjects are imported by relative path from their tests, so no
dist/is involved.Derived gates (dispatch-gates --commands on 4af42bb, 35 families, all run)
dispatch-gates --ran: "35 derived famil(ies) accounted for — 35 run, 0 NOT-MEASURED (a DERIVED zero — all 35 recorded an exit code and none of them is 3)". Round 1 ran the same 35 on 4febaa7, all exit 0.Human Minimum
packages/specholds no runtime logic. (not touched)main(merged in twice), one pull request.packages/spectouched: not touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufziwFKBXQchtNMQYZSX